home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
FNTPAK32.ZIP
/
C.EXE
/
DEMO_MON.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-16
|
2KB
|
75 lines
/*************************************************************************
Demo_Mon.C Copyright 1994, Rob W. Smetana
Turn Screen Swapping ON if appropriate.
Demonstrate how to detect monitor type. We need EGA/VGA to change fonts.
Requires: Video.Obj, which contains function GetMonitor
**************************************************************************/
#include <font_pak.h> /* for prototypes */
int GetFontSize (); /* local get-monitor function to detect EGA/VGA
and return size of default font (14/16)
-or- print error message if appropriate */
void main (void)
{
int FSize;
FSize = GetFontSize (); /* FontSize returns 14, 16 or 0 (no EGA/VGA) */
printf ("Default font height: 8 x %d \n",FSize);
} /* end main */
/*******************************************************************
Function: GetFontSize
Purpose: Check for EGA/VGA and return 14 (EGA 8x14), 16 (VGA 8x16)
or 0 if we're not using an EGA/VGA
Print error message and end if no EGA/VGA
Return FontSize for use in other functions
GetMonitor returns an integer (0 - 8) indicating the type of monitor
in use. If two monitors are being used, GetMonitor returns
the type of the primary monitor.
0 = None (no monitor) 3 = EGA (or MultiSync)
4 = Color (CGA) 5 = Monochrome
7 = VGA Monochrome 8 = VGA Color (or MultiSync)
*******************************************************************/
int GetFontSize ()
{
int MonType;
MonType = GETMONITOR();
switch (MonType) {
case 0, 4, 5: /* no monitor, Mono or CGA */
printf ("\nSorry. An EGA or VGA monitor is required to run this demo. \n\n");
return (0);
break;
case 3: /* EGA. Set fontsize to 8x14 */
printf ("\nEGA (or compatible) monitor detected. \n\n");
return (14);
break;
case 7, 8: /* VGA. Set fontsize to 8x16 */
printf ("\nVGA (or compatible) monitor detected. \n\n");
return (16);
break;
default:
printf ("\nUnknown monitor type. Sorry. An EGA or VGA monitor is required to run this. \n\n");
return (0);
break;
}
}